//
//  RBGoodsSharePopVC.m
//  zhongzhenglu
//
//  Created by XL on 2022/9/14.
//

#import "RBGoodsSharePopVC.h"
#import "RBDefine.h"
#import "UIView+RBAdd.h"
#import "UIScrollView+RBAdd.h"
#import <Masonry.h>
#import "RBThemeConfig.h"
#import <UIColor+YYAdd.h>
#import <UIView+YYAdd.h>
#import "RanTool.h"

@interface RBGoodsSharePopVC ()

@end

@implementation RBGoodsSharePopVC

#pragma mark - Lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setup];
}

#pragma mark - Private

- (void)setup
{
    self.contentView = UIView.new;
    [self.view addSubview:self.contentView];
    self.contentView.backgroundColor = UIColor.whiteColor;
    [self.contentView rbSetCorner:UIRectCornerTopLeft | UIRectCornerTopRight radius:Zoom(20)];
    
    [self.contentView view_addView:[RanTool labelWithFontSize:Zoom(14) weight:0 color:UIColor.blackColor align:0 text:@"分享到"] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(28) bottom:0 left:0 right:0 centerX:1];
    [self.contentView view_addView:({
        UIStackView *view = UIStackView.new;
        view.axis = UILayoutConstraintAxisHorizontal;
        view.distribution = UIStackViewDistributionFillEqually;
        NSArray *imgs = @[@"shareWechat", @"shareTimeline", @"shareQQ", @"shareWeibo"];
        NSArray *titles = @[@"微信好友", @"朋友圈", @"QQ好友", @"新浪微博"];
        for (NSInteger i = 0; i < imgs.count; i++)
        {
            [view addArrangedSubview:({
                UIView *view = UIView.new;
                [view view_addView:[RanTool imgViewWithMode:0 radius:0 imgName:imgs[i]] withHeight:Zoom(65) width:Zoom(65) top:0 bottom:0 left:0 right:0 centerX:1];
                [view view_addView:[RanTool labelWithFontSize:Zoom(14) weight:0 color:@"#222222" align:1 text:titles[i]] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:0 bottom:CGFLOAT_MIN left:0 right:0 centerX:0];
                view;
            })];
        }
        view;
    }) withHeight:Zoom(85) width:CGFLOAT_MIN top:Zoom(17) bottom:0 left:Zoom(11) right:Zoom(11) centerX:0];
    [self.contentView view_addView:({
        UIView *view = [RanTool labelWithFontSize:Zoom(17) weight:0 color:@"#222222" align:1 text:@"取消"];
        [view rbAddTapGesWithTarget:self action:@selector(dismiss)];
        view;
    }) withHeight:Zoom(62) width:CGFLOAT_MIN top:Zoom(23) bottom:kRBSafeBottomHeight left:0 right:0 centerX:0];
    
    self.view.backgroundColor = UIColor.clearColor;
    self.contentView.width = kRBMainScreenWidth;
    self.contentView.height = self.contentView.esSize.height;
    self.contentView.left = 0;
    self.contentView.top = kRBMainScreenHeight;
}

- (void)show
{
    [UIView animateWithDuration:0.15 animations:^{
        self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
        self.contentView.bottom = kRBMainScreenHeight;
    }];
}

- (void)dismiss
{
    [UIView animateWithDuration:0.15 animations:^{
        self.view.backgroundColor = UIColor.clearColor;
        self.contentView.top = kRBMainScreenHeight;
    } completion:^(BOOL finished) {
        [self dismissViewControllerAnimated:NO completion:nil];
    }];
}

#pragma mark - Network

#pragma mark - Event

#pragma mark - Setter

#pragma mark - Getter

@end
